define(function (require, exports, module) {

    var axios = require('lib/axios.js');

    function GetTicket() {
        //从 sessionstory取
        return "13DDFGKLKFDJFL";
    }

    axios.interceptors.request.use(function (config) {
        // 在发送请求之前做些什么
        console.log(config);

        //发送前把当时ticket带入
        if (config.method == "get") {
            config.url = (config.url + (config.url.indexOf('?') > -1 ? "&" : "?") + "token=" + GetTicket());
        } else if (config.methods == "post") {
            config.data = config.data || {};
            config.data.ticket = GetTicket();
        }

        return config;
    }, function (error) {
        //对请求错误做些什么

        return Promise.reject(error);
    });

    axios.defaults.baseURL =baseSiteUrl;


    // 添加响应拦截器
    axios.interceptors.response.use(function (response) {
        // 对响应数据做点什么
        return response;
    }, function (error) {
        // 对响应错误做点什么
        console.log(error);
        //写日志
        return Promise.reject(error);
    });
    var VueComponent = new Vue({
        el: '#app',
        data: {
            width: 200,
            height: 60,
            content: '',
            ToFolderPath: '',
            excelPath:''
        },
        methods: {

            create_go: function () {
                var curVue = this;
                var url = baseSiteUrl+"Tool/createCodeImage.htmls";

                var curContentList=curVue.content.split(",");


                $.ajax({
                    type: 'POST',
                    url: url,
                    dataType: 'json',
                    data: {
                        width: curVue.width,
                        height: curVue.height,
                        ToFolderPath: curVue.ToFolderPath,
                        content: curVue.content,  //SINV8617ERDMDVP556BT4
                        excelPath:curVue.excelPath
                    },
                    success: function (res) {
                        toastr.success('操作成功');
                        // if (res.success) {
                        //     toastr.success('操作成功');
                        // }
                        // else {
                        //     toastr.error(res.msg);
                        // }
                    }
                })
            },
            form_reset: function () {
                this.width = '200';
                this.height = "60";
                this.content = '';
                this.ToFolderPath = "";

            }

        }

    });

});